HAP fault handling for shared pages.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Dec 2009 06:27:56 +0000 (06:27 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Dec 2009 06:27:56 +0000 (06:27 +0000)
Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/mm/hap/p2m-ept.c
xen/arch/x86/mm/p2m.c

index e18e94f34947c3451f176d925760964696f5f6cd..3109a6df03256c24bdf0c905ede07f19a475c5e6 100644 (file)
@@ -960,6 +960,13 @@ bool_t hvm_hap_nested_page_fault(unsigned long gfn)
         return 1;
     }
 
+    /* Mem sharing: unshare the page and try again */
+    if ( p2mt == p2m_ram_shared )
+    {
+        mem_sharing_unshare_page(current->domain, gfn, 0);
+        return 1;
+    }
     /* Shouldn't happen: Maybe the guest was writing to a r/o grant mapping? */
     if ( p2mt == p2m_grant_map_ro )
     {
index 4cb4d01c5a9ed01ea393ab4e2a61b16cbd546ff3..53697b37613ad005def1b2c6faede1c16f1f4c51 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/io.h>
 #include <asm/paging.h>
 #include <asm/p2m.h>
+#include <asm/mem_sharing.h>
 #include <asm/regs.h>
 #include <asm/cpufeature.h>
 #include <asm/processor.h>
index 4c7d63d94e222a39221892731b895c51b5b9329d..330cf7c31e8317a6f89d6999692a83eb7f251a0e 100644 (file)
@@ -37,6 +37,7 @@
 #include <asm/spinlock.h>
 #include <asm/paging.h>
 #include <asm/p2m.h>
+#include <asm/mem_sharing.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/support.h>
index f8bffff1c3b29b577f0d37a1a00bbf86c9e5ef12..a7f8db418618ac575a3874361fd821fd97855287 100644 (file)
@@ -71,6 +71,7 @@ static void ept_p2m_type_to_flags(ept_entry_t *entry, p2m_type_t type)
             return;
         case p2m_ram_logdirty:
         case p2m_ram_ro:
+        case p2m_ram_shared:
             entry->r = entry->x = 1;
             entry->w = 0;
             return;
index 8f575d088f38eff02577649f87859f951a1391be..ab74323f4a7a90198f841aed95b59d84cefb090e 100644 (file)
@@ -92,6 +92,8 @@ static unsigned long p2m_type_to_flags(p2m_type_t t)
     case p2m_ram_ro:
     case p2m_grant_map_ro:
         return flags | P2M_BASE_FLAGS;
+    case p2m_ram_shared:
+        return flags | P2M_BASE_FLAGS;
     case p2m_mmio_dm:
         return flags;
     case p2m_mmio_direct: